package cliente;

import elementos.Ranking;
import java.io.Serializable;

public class Fase implements Serializable{
    private final int maxGoal = 5;
    private int numero,score1,score2;
    private String player1,player2;
    private float time;
    private Ranking ranking;
    private int vida;
    private final int maxVida = 0;

    public Fase(int numero, int score1, int score2, String player1, String player2, float time) {
        this.numero = numero;
        this.score1 = score1;
        this.score2 = score2;
        this.player1 = player1;
        this.player2 = player2;
        this.time = time;
        this.vida=5;
    }

    public Ranking getRanking() {
        return ranking;
    }

    public void setRanking(Ranking ranking) {
        this.ranking = ranking;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public int getScore1() {
        return score1;
    }

    public void setScore1(int score1) {
        this.score1 = score1;
    }

    public int getScore2() {
        return score2;
    }

    public void setScore2(int score2) {
        this.score2 = score2;
    }

    public float getTime() {
        return time;
    }

    public void setTime(float time) {
        this.time = time;
    }
    
    public boolean isFinished(){
        return (score1>=maxGoal || score2>=maxGoal);
    }

    public String getPlayer1() {
        return player1;
    }

    public void setPlayer1(String player1) {
        this.player1 = player1;
    }

    public String getPlayer2() {
        return player2;
    }

    public void setPlayer2(String player2) {
        this.player2 = player2;
    }
    
    public boolean perderVida(){
        vida--;
        return vida==maxVida;
    }

    public int getVida() {
        return vida;
    }
}
